#!usr/bin/env python
#coding=utf8

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
from tuangou import config


urlpatterns = patterns('',
    # Example:
    # (r'^mysite/', include('mysite.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/(.*)', admin.site.root),

    url(r'^static/(?P<path>.*)$', 'django.views.static.serve', 
      {'document_root': config.STATIC_PATH}, name="static-path"),
    url(r'(?P<path>.*(\.ico|\.jpg|\.gif|\.png|\.js|\.css))$', 'django.views.static.serve', 
      {'document_root': config.STATIC_PATH}, name="static-file-path"),

    url(r'^tuangou_admin/', include('%s.web.admin.urls' % config.PROJECT_NAME)),

    url(r'^(?i)puductindex/?$', 
         '%s.web.tuangou.views.index' % config.PROJECT_NAME, {'order_by': '-createdtime'}, name='site-index'),
    url(r'^/?$', 
         '%s.web.tuangou.views.indexpage' % config.PROJECT_NAME, name='site-indexpage'),

    url(r'^(?i)category/(?P<category_id>\d+)/(?P<category_type>\w+)/?$', 
         '%s.web.tuangou.views.get_list_by_category' % config.PROJECT_NAME, name='item-list-category'),                       
                       
    url(r'^(?i)product/(?P<product_id>\d+)/?$', 
         '%s.web.tuangou.views.product_detail' % config.PROJECT_NAME, name='product-detail-info'),

    url(r'^(?i)tuan/?$', 
        '%s.web.tuangou.views.tuan_index' % config.PROJECT_NAME, {'order_by': '-tuan_saledate'}, name='tuan-index'),
    url(r'^(?i)tuan/(?P<tuan_id>\d+)/?$', 
         '%s.web.tuangou.views.tuan_detail' % config.PROJECT_NAME, name='tuan-detail-info'),
    url(r'^(?i)itemtuan/(?P<product_id>\d+)/?$', 
         '%s.web.tuangou.views.tuan_list_by_item_id' % config.PROJECT_NAME, {'order_by': '-tuan_saledate'}, name='item-tuan-list'),             

    url(r'^(?i)about/?$', 
        '%s.web.tuangou.views.about_us' % config.PROJECT_NAME, name='about-us'),
    url(r'^(?i)contact/?$', 
        '%s.web.tuangou.views.contact_us' % config.PROJECT_NAME, name='contact-us'),
    url(r'^(?i)join/?$', 
        '%s.web.tuangou.views.join_us' % config.PROJECT_NAME, name='join-us'),
    url(r'^(?i)cooperate/?$', 
        '%s.web.tuangou.views.co_application' % config.PROJECT_NAME, name='co-application'),
    url(r'^(?i)cooperate/save/?$', 
        '%s.web.tuangou.views.save_co_application' % config.PROJECT_NAME, name='save-co-application'),
    url(r'^(?i)feedback/?$', 
        '%s.web.tuangou.views.feedback' % config.PROJECT_NAME, name='feedback'),                       
    url(r'^(?i)feedback/save/?$', 
        '%s.web.tuangou.views.save_feedback' % config.PROJECT_NAME, name='save-feedback'),

    url(r'^(?i)search/(?P<keyword>\w+)/?$', '%s.web.tuangou.views.search' % config.PROJECT_NAME, name='site-search'),
                       
    url(r'^(?i)platform/?$', 
         '%s.web.tuangou.views.platform' % config.PROJECT_NAME, name='site-platform'),
    url(r'^(?i)brand/?$', 
         '%s.web.tuangou.views.brand' % config.PROJECT_NAME, name='site-brand'),
)

handler404 = 'tuangou.web.tuangou.views.my_custom_404_view'
handler500 = 'tuangou.web.tuangou.views.my_custom_500_view'
